import React, { Component } from 'react'
import { connect } from 'dva';
import Link from 'umi/link';
import { Form } from 'antd';
import { SearchRow, SearchCol, SearchButton } from '@/styled/form';

interface Props {
  current: number,
  form: any,
  dispatch?: Function,
  initCurrent: Function,
  locationData?: Array<any>,
  optionData?: Array<string>,
  areaData?: Array<string>,
  dictList?: object,
  cond?: any;
  file?: {
    message: string;
    url: string;
  };
}

@connect(({ upload, archives_point }) => ({
  dictList: archives_point.dictList,
  cond: archives_point.cond,
  file: upload.fileValue || {},
}))
class Search extends Component<Props, any> {

  showUpload = (v) => {
    const { dispatch } = this.props;
    dispatch({
      type: 'archives_point/queryTemple',
      payload: {
        type: 'archives_point',
      }
    })
  }

  render() {

    return (
      <Form>
        <SearchRow>
          <SearchCol key={1} span={24}>
            <SearchRow type="flex" justify="end">
            <SearchButton icon="select" style={{ marginRight: '10px' }} onClick={this.showUpload}>导入</SearchButton>
            <Link to='/data/archives_point/new'><SearchButton icon="plus" type="primary">新增</SearchButton></Link>
            </SearchRow>
          </SearchCol>
        </SearchRow>
      </Form >
    );
  }
}

const SearchS = Form.create<Props>()(Search);
export default SearchS;
